<template>

	<el-main style="padding:0 20px;">
		<el-descriptions :column="1" border size="medium">
			<el-descriptions-item label="请求接口">{{data.operUrl}}</el-descriptions-item>
			<el-descriptions-item label="请求方法">{{data.requestMethod}}</el-descriptions-item>
			<el-descriptions-item label="操作状态">
				<span v-if="data.status==0 || data.status == 200">正常</span>
				<span v-else style="color: #FF0000">失败</span>
			</el-descriptions-item>
			<el-descriptions-item label="日志名">{{data.title}}</el-descriptions-item>
			<el-descriptions-item label="日志时间">{{data.operTime}}</el-descriptions-item>
		</el-descriptions>
		<el-collapse v-model="activeNames" style="margin-top: 20px;">
			<el-collapse-item title="常规" name="1" v-if="data.status==0">
				<el-alert :title="data.jsonResult" :type="typeMap[data.level]" :closable="false"></el-alert>
			</el-collapse-item>
			<el-collapse-item title="日志" name="2" v-else>
				<div class="code">
					{{ data.jsonResult }}
				</div>
			</el-collapse-item>
		</el-collapse>
	</el-main>
</template>

<script>
	export default {
		data() {
			return {
				data: {},
				activeNames: ['1'],
				typeMap: {
					'info': "info",
					'warn': "warning",
					'error': "error"
				}
			}
		},
		methods: {
			setData(data){
				this.data = data
			}
		}
	}
</script>

<style scoped>
	.code {background: #848484;padding:15px;color: #fff;font-size: 12px;border-radius: 4px;}
</style>
